import { tfGet, yfuPost } from '@/utils/request'
import global_ from '@/utils/global.vue'

export function getUserList (param, then1, error1) {
  if (global_.isLocalServer) {
    tfGet('/static/userList.json', then1, error1)
  } else {
    yfuPost(process.env.BASE_API, '/user/getUserInfoList', param, then1, error1)
  }
}

export function updateUserStatus (param, then1, error1) {
  if (global_.isLocalServer) {
  } else {
    yfuPost(process.env.BASE_API, '/user/updateUserStatus', param, then1, error1)
  }
}

export function updatePassword (param, then1, error1) {
  if (global_.isLocalServer) {
  } else {
    yfuPost(process.env.BASE_API, '/user/updatePassword', param, then1, error1)
  }
}

export function updateSkin (param, then1, error1) {
  if (global_.isLocalServer) {
  } else {
    yfuPost(process.env.BASE_API, '/user/updateSkin', param, then1, error1)
  }
}

export function getRoleListWithoutPage (param, then1, error1) {
  if (global_.isLocalServer) {
  } else {
    yfuPost(process.env.BASE_API, '/role/getRoleListWithoutPage', param, then1, error1)
  }
}

export function getUserInfoByUserId (param, then1, error1) {
  if (global_.isLocalServer) {
  } else {
    yfuPost(process.env.BASE_API, '/user/getUserInfoByUserId', param, then1, error1)
  }
}

export function addUser (param, then1, error1) {
  if (global_.isLocalServer) {
  } else {
    yfuPost(process.env.BASE_API, '/user/addUser', param, then1, error1)
  }
}

export function updateUserInfo (param, then1, error1) {
  if (global_.isLocalServer) {
  } else {
    yfuPost(process.env.BASE_API, '/user/updateUserInfo', param, then1, error1)
  }
}

export function newUser (param, then1, error1) {
  yfuPost(process.env.BASE_API, '/user/save', param, then1, error1)
}

export let getUserListRemote = {
  name: '得到所有人员',
  url: '/user/getUserInfoList',
  functionName: 'getUserInfoList'
}

export let getUserListNotOrganizationRemote = {
  name: '得到所有人员',
  url: '/user/getUserInfoListNotOrganization',
  functionName: 'getUserInfoListNotOrganization'
}

export let getUserByUsernameRemote = {
  name: '得到人员根据用户名',
  url: '/user/getUserInfoByUserName',
  functionName: 'getUserInfoByUserName'
}

export let getUserByTrueNameRemote = {
  name: '得到人员根据真实姓名',
  url: '/user/getUserInfoByTrueName',
  functionName: 'getUserInfoByTrueName'
}
